#include <stdio.h>
#include <stdarg.h>

double average(int n,...){
    va_list valist;
    double sum=0.0;
    int i;
    va_start(valist,n);
    for(i=0;i<n;i++){
        sum+=va_arg(valist,int);
    }
    va_end(valist);
    return sum/n;
}

int main(){
    printf("Average of 2,3,4,5 = %f\n",average(4,2,3,4,5));
    printf("Average of 5,10,15 = %f\n",average(3,5,10,15));
}

